//LCP 44. 开幕式焰火
//思路：深度优先遍历+哈希表

#include <stdio.h>
struct TreeNode {
    int val;
    struct TreeNode *left;
    struct TreeNode *right;
};
void dfs(struct TreeNode* root, int* hash, int* count)
{
    if(NULL == root)
        return;
    
    if(hash[root->val] == 0)
    {
        *count += 1;
        hash[root->val] = 1;
    }

    dfs(root->left, hash, count);
    dfs(root->right, hash, count);
}
int numColor(struct TreeNode* root){
    int hash[1000] = {0};
    int count = 0;
    dfs(root, &hash, &count);

    return count;
}